<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IndexPayload>" %>
<%@ Import Namespace="ActivateYourGlutes.Payloads.Goal"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Goals
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
    var activeGoals = ViewData.Model.ActiveGoals;
    var achievedGoals = ViewData.Model.AchievedGoals;
    var hasActiveGoals = activeGoals.Any();
    var hasAchievedGoals = achievedGoals.Any();
%>
    <div id="subheader">
        <h2>Goals</h2>        
        <div>
            <%= Html.ActionLink("New Goal", MVC.Goal.Create()) %>
        </div>
    </div>
    
<%
    if (!hasAchievedGoals && !hasActiveGoals)
    {
%>
    <p>You have not yet set any goals. Setting goals can help you achieve your targets.</p>
    <p><%= Html.ActionLink("Add a goal now", MVC.Goal.Create()) %></p>
<%
    }
    else
    {
        if (hasAchievedGoals)
        {
%>
            <h3>Achieved Goals</h3>
            <%
            Html.RenderPartial(MVC.Shared.Views.GoalSummary, achievedGoals);
        }

        if (hasActiveGoals)
        {
%>
            <h3>Active Goals</h3>
            <%
                Html.RenderPartial(MVC.Shared.Views.GoalSummary, activeGoals);
        }
    }
%>
</asp:Content>
